package cn.lili.modules.member.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.member.entity.dos.RedPackUser;
import cn.lili.modules.member.fallback.RedPackUserFallback;
import cn.lili.modules.payment.entity.dto.UserRedPackUpdateDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.USER_SERVICE, contextId = "red-pack", fallback = RedPackUserFallback.class)
public interface RedPackUserClient {

    /**
     * 根据用户ID获取用户红包
     *
     * @param userId 用户id
     * @return 红包
     */
    @GetMapping("/feign/redPack/{userId}")
    RedPackUser getRedPackUser(@PathVariable String userId);

    /**
     * 用户红包变动
     *
     * @return 操作结果
     */
    @PutMapping("/feign/redPack/updateMemberRedPack")
    void updateMemberRedPack(@RequestBody UserRedPackUpdateDTO userRedPackUpdateDTO);

    @GetMapping("/feign/redPack/getListByLastTime")
    List<RedPackUser> getListByLastTime ();

    @PostMapping("/feign/redPack/updateById")
    void updateById (@RequestBody RedPackUser redPackUser);
}
